//
//  CollectionViewLayout.h
//  test
//
//  Created by huichen on 2018/6/4.
//  Copyright © 2018年 huichen. All rights reserved.
//

#import <UIKit/UIKit.h>
typedef CGFloat(^WidthBlock) (NSIndexPath *indexPath,CGFloat height);

@protocol CollectionViewLayoutDelegate <NSObject>

- (void)collectionViewLayoutChangeSuperViewHeight:(CGFloat)height;

@end


@interface CollectionViewLayout : UICollectionViewFlowLayout

/**
 *  行数
 */
@property (nonatomic, assign) NSInteger rowNumber;

/**
 *  实际行数
 */
@property (nonatomic, assign) NSInteger currentowNumber;

/**
 *  行间距
 */
@property (nonatomic, assign) CGFloat rowSpacing;
/**
 *  列间距
 */
@property (nonatomic, assign) CGFloat lineSpacing;
/**
 *  内边距
 */
@property (nonatomic, assign) UIEdgeInsets sectionInset;


@property(nonatomic, weak) id <CollectionViewLayoutDelegate> delegate;
/**
 *
 *  @param block 在block中最后要返回一个item的宽度
 */
- (void)computeIndexCellHeightWithWidthBlock:(CGFloat(^)(NSIndexPath *indexPath , CGFloat height))block;

- (id)initWithCollectionViewHeight:(CGFloat)height;

@end
